<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>论文审核Grid页面——CellId：JKY_JKS_TJLWSP</title>
<%@ include file="/module/js.jsp"%>
</head>
<body>
	<form action="#" name="Form" id="Form" method="post">
		<input type="hidden" name="idList" id="idList"/>
		<%@ include file="/module/orderField.jsp"%>
		<table cellpadding="1" cellspacing="1" border="0">
			<tr>
			    <td><input type="button" id="btnQuery" value="查询"
					class="inputButton" /></td>
				<td><input type="button" id="btnExport" value="导出"
				 class="inputButton"/></td>	
				<td><input type="button" id="btnTJ" value="设置为推荐" 
					class="inputButton" /></td>
				<td><input type="button" id="btnbTJ" value="设置为不推荐"
					 class="inputButton"/></td>
			   <td><input type="button" id="btnzjGroup" value="专家组管理"
					 class="inputButton"/></td>
			</tr>
		</table>

		<table cellpadding="1" cellspacing="1" >
			<tr>
				<td>审批结果：</td>
				<td align="left"><select id="tjjg" name="tjjg" class="selectList2">
					<option value="">全部</option>
					<option value="推荐">推荐</option>
					<option value="不推荐">不推荐</option>
				</select></td>
				<td>部门： </td><td><select id="ksId" name="ksId" class="selectList2">
					<option value="0">全部</option>
					<c:forEach items="${deptList}" var="data" varStatus="index">
						<option value="${data.ksId}">${data.ksMc}</option>

					</c:forEach>
				</select>
				</td><td>
					教研组： </td><td><select id="tgId" name="tgId" class="selectList2">
						<option value="0">全部</option>
						<c:forEach items="${orgList}" var="data" varStatus="index">
							<option value="${data.tgId}">${data.jyzMc}</option>

						</c:forEach>
					</select>
				</td>

				</tr>
			<tr>
				<td>题目：</td>
				<td><input type="text" name="subject" id="subject" value=""  autocomplete="off" class="inputText2" />
				</td>
				<td>获奖级别：</td>
				<td>
					<input type="text" name="hjjb" id="hjjb" value=""  autocomplete="off" class="inputText2" />
				</td>
			</tr>
			<tr>
				<td>姓名：</td>
				<td>
					<input type="text" name="xm" id="xm" value=""  autocomplete="off" class="inputText2" />
				</td>

				<td>工号：</td>
				<td>
					<input type="text" name="empId" id="empId" value=""  autocomplete="off" class="inputText2" />
				</td>

				<td>提交日期：</td>
				<td colspan="3">
					<input type="text" name="startTime" id="startTime"   autocomplete="off"
						   class="Wdate inputText2" value=""
						   onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>&nbsp;到
					<input type="text" name="endTime" id="endTime"   autocomplete="off"
						   class="Wdate inputText2" value=""
						   onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
				</td>

			</tr>
		</table>

     	<table id="dg"  style="width:90%;"
			data-options="pagination:true,collapsible:true,url:'${basePath}/teacherThesisAuditing/list',method:'post',remoteSort:true">
			<thead>
				<tr>
					<th data-options="field:'lwid',checkbox:true,width:80,align:'center'"></th>
					<th data-options="field:'xm',nowrap:true,width:150,align:'center',sortable:true,formatter:formater">姓名</th>
					<th data-options="field:'zgh',nowrap:true,width:150,align:'center',sortable:true">工号</th>
					<th data-options="field:'ksMc',nowrap:true,width:150,align:'center',sortable:true">所在部门</th>
					<th data-options="field:'subject',nowrap:true,width:150,align:'center',sortable:true">论文题目</th>
					<th data-options="field:'lwsj',nowrap:true,width:150,align:'center',sortable:true">论文时间</th>
					<th data-options="field:'tjjg',nowrap:true,width:150,align:'center',sortable:true">推荐结果</th>
					<th data-options="field:'hhjb',nowrap:true,width:150,align:'center',sortable:true">获奖级别</th>
					<th data-options="field:'createTime',nowrap:true,width:200,align:'center',sortable:true,formatter:formatDate">提交时间</th>
				</tr>
			</thead>
		</table>
	</form>
	<script>
	 function formater(value, row, index) {
	       return "<a href='${basePath}/teacherThesisAuditing/addInInt?lwid=" + row.lwid + "'>" + row.xm + "</a>";
	  }
  
	  
	</script>
	<script type="text/javascript">
		$(document).ready(
			function() {

			$('#dg').datagrid({
			   rowStyler: function(index,row){
			   },
			   onLoadSuccess: function(data){//加载完毕后获取所有的checkbox遍历
	           		if (data.rows.length > 0) {
					}
				},
			});
			//查询
			$('#btnQuery').click(function(){
				$('#dg').datagrid('load',{
					tjjg : $('#tjjg').val(),
					subject : $('#subject').val(),
					hjjb : $('#hjjb').val(),
					startTime: $('#startTime').val(),
					endTime: $('#endTime').val(),
					ksId : $('#ksId').val(),
					tgId : $('#tgId').val(),
					empId : $('#empId').val(),
					xm : $('#xm').val()
				});
			});
	 		$('#easyui-ck').click(function() {
				var data = $("#dg").datagrid("getSelections");
				for (var i = 0; i < data.length; i++) {
            	}
			});

			// 设置为推荐
			$('#btnTJ').click(function() {
			   $("#idList").val("");
				var count = 0;
				var idList = new Array();
				var sels = $("#dg").datagrid("getSelections");
				for(var i in sels){
					idList.push(sels[i].lwid);
					count++;
				}

				if (count == 0) {
					layer.alert("您至少选择一条推荐记录信息", {icon: 3});
					return false;
				}else{
					  layer.confirm("您是否设置为推荐当前选中数据信息", {icon: 3, title:'提示',skin:'layer-ext-moon'}, function(index){
							$("#idList").val(idList);
							document.Form.action = "${basePath}/teacherThesisAuditingAuditing/recommend?action=1";
							document.Form.submit();
					  },function(index){
							layer.close(index);
					  });
				}
			});
		});
		// 设置为不推荐
		$('#btnbTJ').click(function() {
			   $("#idList").val("");
				var count = 0;
				var idList = new Array();
				var sels = $("#dg").datagrid("getSelections");
				for(var i in sels){
					idList.push(sels[i].lwid);
					count++;
				}

				if (count == 0) {
					layer.alert("您至少选择一条不推荐记录信息", {icon: 3});
					return false;
				}else{
					  layer.confirm("您是否设置为不推荐当前选中数据信息", {icon: 3, title:'提示',skin:'layer-ext-moon'}, function(index){
							$("#idList").val(idList);
							document.Form.action = "${basePath}/teacherThesisAuditing/recommend?action=2";
							document.Form.submit();
					  },function(index){
							layer.close(index);
					  });
				}
			});
	
		// 导出
		$('#btnExport').on('click', function(){
			   layer.confirm("您确定要导出吗?", function(index){
				   //var rows = $("#dg").datagrid("getRows"); {icon: 3, title:'提示',skin:'layer-ext-moon'},
				  // var bodyData = JSON.stringify(rows);  //转成json字符串
				   // $("#bodyData").val(JSON.stringify(rows));
					    document.Form.action = "${basePath}/teacherThesisAuditing/export_teacherThesisAuditing";
						document.Form.submit();
						layer.close(index);
     		 });
			});
	 
		//添加专家组
		$('#btnzjGroup').click(function() {
			document.Form.action = "${basePath}/teacherReviewGroup/index";
			document.Form.submit();
		});
		
		if("${msg}"!=""){
		   layer.alert("${msg}", {icon: 6});
		}
	</script>
</body>
</html>
